<?php
if(!isset($metaphone))
{
    $metaphone = true;
}
?>
<form action="<?php echo(mczUrl('search'));?>" method="get">
	<fieldset>
        <input type="hidden" name="c" value="search"/>
		<legend><?php echo(htmlspecialchars(T('Index search')));?></legend>
		<!--<label for="terms"><?php echo(htmlspecialchars(T('Terms')));?></label>-->
		<input type="text" name="searchTerms" id="terms" value="<?php echo(htmlspecialchars(!empty($searchTerms) ? $searchTerms : ''));?>"/>
		<input type="checkbox" id="metaphone" name="metaphone" <?php echo($metaphone ? ' checked="checked"' : '');?>/>
		<label for="metaphone"><?php echo(htmlspecialchars(T('fuzzy?')));?></label>
		<input type="submit" value="<?php echo(htmlspecialchars(T('Search')));?>"/>
		<a href="<?php echo mczURL('playlist/all');?>">Playlists</a>
	</fieldset>
</form>
<?php if(isset($searchResults) and !empty($searchTerms)){ ?>
	<form method="post" action="<?php echo(mczURL('tune/list'));?>">
    <fieldset>
        <legend><?php echo(htmlspecialchars(T('Results')));?></legend>
        <?php
        if($searchResults['total'] > 0){
            $i = 0;
        ?>
            <?php
		include(mcz_VIEWS_DIR . 'pager.php');
                echo($pager);
		$tunes = $searchResults['items'];
		include(mcz_VIEWS_DIR . 'tunes.php');
	    ?>
        <?php echo($pager);} else{ ?>
        <p class="notice"><?php echo(htmlspecialchars(T('No results')));?></p>
        <?php } ?>
    </fieldset>
	</form>
<?php } ?>